package com.jgame.secondarymarket.domain.product.repository;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jgame.secondarymarket.domain.product.entity.Specification;
import com.jgame.secondarymarket.interfaces.query.page.product.PageSpecificationQuery;

import java.util.List;
import java.util.Optional;

public interface SpecificationRepository extends IService<Specification> {
    List<Specification> listByProductId(Long productId);

    Optional<Specification> findByValue(Long productId, String value);

    Specification findByValueOrThrow(Long productId, String value);

    List<Specification> findByValues(Long productId, List<String> values);

    Optional<Specification> findById(Long productId, Long specificationId);

    Specification findByIdOrThrow(Long productId, Long specificationId);

    void delByProductId(Long productId);

    void delByIds(Long productId, List<Long> specificationIds);

    IPage<Specification> getPage(PageSpecificationQuery query);

    List<Specification> listByProductIds(List<Long> productIds);

    List<Specification> listByProductIdAndPropertiesIds(Long productId, List<Long> propertiesId);
}
